import { addNameSpace } from './util'

const NAME_SPACE = 'RECHARGE_RECORD'

const addPrefix = addNameSpace(NAME_SPACE)

// 输入充值单号
export const SET_ORDER_NUM = addPrefix('SET_ORDER_NUM')

// 选择类型
export const SET_TYPE = addPrefix('SET_TYPE')

// 设置开始时间
export const SET_START_TIME = addPrefix('SET_START_TIME')

// 设置结束时间
export const SET_END_TIME = addPrefix('SET_END_TIME')

// 获取数据
export const GET_DATA = addPrefix('GET_DATA')

// 获取数据成功
export const GET_DATA_SUCCESS = addPrefix('GET_DATA_SUCCESS')

// 获取数据失败
export const GET_DATA_FAIL = addPrefix('GET_DATA_FAIL')

// 设置page num
export const SET_PAGE_NUM = addPrefix('SET_PAGE_NUM')

export default {

  setOrderNum : (orderNum) => ({ type: SET_ORDER_NUM, orderNum }),

  setType: (payload) => ({ type: SET_TYPE, payload }),

  setStartTime: (startTime) => ({ type: SET_START_TIME, startTime }),

  setEndTime: (endTime) => ({ type: SET_END_TIME, endTime }),

  getData: () => ({ type: GET_DATA }),

  getDataSuccess: (data) => ({ type: GET_DATA_SUCCESS, data }),

  getDataFail: () => ({ type: GET_DATA_FAIL }),

  setPageNum: (pageNum) => ({ type: SET_PAGE_NUM, pageNum }),
}